--- title: `data_process` keywords: fastai sidebar: home_sidebar nb_path: "nbs/02_data_process.ipynb" ---
import holoviews as hv
hv.extension('bokeh')
dir_data = Path('../../kgl_humanprotein_data/')
dir_segmodels = Path('../../hpa-cell-segmentation-models/')
dir_hpa = dir_data/'hpa-single-cell-image-classification'
dir_trn = dir_hpa/'train'
dir_test = dir_hpa/'test'
def unzip_zipped_files(src):
'''
Unzip all zipped files and remove the zipped version in
directory `src`. Note this assumed each zip file unpacks
to just a file with the same name except the 'zip' at the end.
Args:
src (pathlib.Path): Directory containing zipped files. This
will also be the directory to unpack to.
'''
for fn in src.glob('*.zip'):
with zipfile.ZipFile(fn) as archive:
archive.extractall(path=fn.parent)
if (fn.parent/fn.stem).exists():
fn.unlink()
# list(dir_test.iterdir())
idx = 3
imgid = imgids_testing[idx]
img = load_RGBY_image(dir_trn, imgid)
hv.RGB(img[...,:3])